package avicit.bdp.dms.dss.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;

/**
 * 数据服务_日志实体
 */
@ApiModel(value = "DssLogDTO", description = "数据服务_日志")
@Table(name = "bdp_dss_log")
public class DssLogDTO extends BaseDTO {

    /**
     * 主键
     */
    @LogField
    @ApiModelProperty(value = "主键")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @Column(name = "id")
    @Id
    @javax.persistence.Id
    private String id;

    /**
     * 数据资源id
     */
    @LogField
    @ApiModelProperty(value = "数据资源id")
    @FieldRemark(column = "dataResourceId", field = "dataResourceId", name = "数据资源id")
    @Column(name = "data_resource_id")
    private String dataResourceId;
    /**
     * 类型 1-申请 2-查询 3-下载 4-调用api
     */
    @LogField
    @ApiModelProperty(value = "类型 1-申请 2-查询 3-下载 4-调用api")
    @FieldRemark(column = "type", field = "type", name = "类型 1-申请 2-查询 3-下载 4-调用api")
    @Column(name = "type")
    private Integer type;
    /**
     * 开始时间
     */
    @LogField
    @ApiModelProperty(value = "开始时间")
    @FieldRemark(column = "startTime", field = "startTime", name = "开始时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "start_time")
    private Date startTime;
    /**
     * 结束时间
     */
    @LogField
    @ApiModelProperty(value = "结束时间")
    @FieldRemark(column = "endTime", field = "endTime", name = "结束时间")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "end_time")
    private Date endTime;
    /**
     * 使用人
     */
    @LogField
    @ApiModelProperty(value = "使用人")
    @FieldRemark(column = "callUser", field = "callUser", name = "使用人")
    @Column(name = "call_user_id")
    private String callUserId;

    /**
     * 使用人
     */
    @LogField
    @ApiModelProperty(value = "使用人姓名")
    @FieldRemark(column = "callUserName", field = "callUserName", name = "使用人姓名")
    @Column(name = "call_user_Name")
    private String callUserName;
    /**
     * 调用状态
     */
    @LogField
    @ApiModelProperty(value = "调用状态")
    @FieldRemark(column = "callStatus", field = "callStatus", name = "调用状态")
    @Column(name = "call_status")
    private Integer callStatus;
    /**
     * 调用结果
     */
    @LogField
    @ApiModelProperty(value = "调用结果")
    @FieldRemark(column = "callResult", field = "callResult", name = "调用结果")
    @Column(name = "call_result")
    private String callResult;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getDataResourceId() {
        return dataResourceId;
    }

    public void setDataResourceId(String dataResourceId) {
        this.dataResourceId = dataResourceId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getCallUserId() {
        return callUserId;
    }

    public void setCallUserId(String callUserId) {
        this.callUserId = callUserId;
    }

    public Integer getCallStatus() {
        return callStatus;
    }

    public void setCallStatus(Integer callStatus) {
        this.callStatus = callStatus;
    }

    public String getCallResult() {
        return callResult;
    }

    public void setCallResult(String callResult) {
        this.callResult = callResult;
    }

    public String getCallUserName() {
        return callUserName;
    }

    public void setCallUserName(String callUserName) {
        this.callUserName = callUserName;
    }

    @Override
    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "数据服务模块";
        } else {
            return super.logFormName;
        }
    }

    @Override
    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "数据调用日志";
        } else {
            return super.logTitle;
        }
    }

}

